SRENAME 2.940    USER'S MANUAL

                          Copyright (C) 1996-2000 Constantinos Nicolakakis



                    Introduction
                    Program status
                    Credits
                    Requirements
                    Installation
                    Technical
                    Usage
                          File/Directory selectors
                          Redirection keywords
                          Character selectors
                                               Keywords used by Character selectors
                          Action keywords
                                               Keywords used by Actions
                    Renumbering
                    Numbering
                    Special keywords
                    Output control
                    Emulated functions
                    Priorities
                    Tips
                    Limitations
                    History
                    Interface changes & additions
                    Known bugs





INTRODUCTION :


The philosophy behind SRename is to give the user a CLI command with relatively
few but versatile functions that can be combined in many ways to provide whatever
renaming operation is needed by the user, rather than providing dozens of
specialised renaming options that limit the renaming operations that can be
performed to what the programmer had in mind when he was designing the command,
and are difficult to remember by the user.
SRename is completely compatible with the OS Rename command and can easily
replace it.

Some of SRename's advantages:

      * Compatible with the OS Rename command.
      * Selector-Action keyword separation that allows building specialized
        functions easily.
      * Total control over recursion.
      * Wildcard and multiple filename support.
      * Optional wildcard for directory selection in recursion.
      * Can isolate selected parts of the filename for modification with the use
        of the selector keywords.
      * Executes multiple actions in one go.
      * Performs intelligent renumbering with automatic checking for filename
        clashes.
      * Can also perform numbering and can modify filename comments.
      * Supports long filenames on filesystems that allow them.
      * It's free.



PROGRAM STATUS :


SRename is freeware. Permission is granted to distribute free of charge,
in unchanged form, provided this documentation file is accompanied with the
program.
Permission is granted to include on freely distributable software libraries
such as Aminet CD-ROMs.
The author's permission is required if SRename is to be distributed as a part
of a commercial application.
Although I'm quite confident that SRename contains no major bugs I can't
guarantee that it is completely bug-free and do not accept any responsibility
of any damage this program could cause directly or indirectly.



CREDITS :


Many thanks to prof. Fulvio Peruggi who sent me his old 68030 board so that
I could revive my A4000 whose CS-PPC died because of me trying to overclock
it :-( , and has also done beta testing and has made useful suggestions.
Thanks also to Bill Duxbury for his beta testing, bug reporting and useful
suggestions.
I also want to thank all the people who have contacted me about SRename.



REQUIREMENTS :


Amiga with kickstart 3 or higher.



INSTALLATION :


Just copy the version of SRename that suits your processor to your C:
directory (remove the ".020" extension from the 68020+ version if you are
installing that).
If you want SRename to replace the OS Rename command then you can store the
OS Rename somewhere and rename SRename as "Rename".
Another way is to use the "MakeLink" command to link SRename as "Rename".
This way you can use it both as "Rename" and as "SRename".



TECHNICAL :


SRename is written in C++ and was compiled with SAS C 6.58. It uses C++
features like object classes to achieve code reusability, memory management
reliability and good program design.
Memory is allocated dynamically in pages to avoid high memory usage.
Average memory usage is around 100-200 Kb when recursing through large disks
or partitions.
It always uses buffers when renaming more than one filename as the Ram Disk's
filesystem has a bug that makes unbuffered renaming with pattern matching
problematic.





USAGE :


Unlike other rename programs SRename separates the available functions into two
types that can be combined. The first type is the functions that select the
part or parts of the filename to be modified and are called Selectors, and the
second type is the functions that modify the selected parts of the filename and
are called Actions.
By combining those two types of function the user can select which part of the
filename he wants to modify and how it should be modified. Of course the user
doesn't have to give any selectors if he doesn't need to, so in that case the
whole filename will be modified.

The complete command set is as follows:


FROM/A/M,TO=AS/K,SAMEPATH=SP/S,ALL/S,RLEVEL=RL/N,SLEVEL=SL/N,DIRPAT=DP/K,
GLOBALDIRPAT=GD/S,FILES=FL/S,DIRS=DR/S,ICONS=IC/S,DOT/K,WSEP=WS/K,COMMENT=CO/S,
PREFIX=PR/S,MAIN=MA/S,SUFFIX=SU/S,WORD=WD/K,INCLSEP=IS/N,LEFT=L/K,MID=M/K,RIGHT=R/K,
MATCH=MT/K,DO/N,SKIP=SK/N,BEFORE=BF/S,AFTER=AF/S,REVMATCH=RM/S,EXCLUDE=XC/S,
ADD=AD/S,CASESENS=CS/S,TOFILENAME=TF/S,TOCOMMENT=TC/S,UPPER=UP/S,LOWER=LW/S,
UPAFTERSPC=US/S,INSERT=IN/K,AT/N,UPDATE=UD/S,DELETE=DL/S,SWAP=SW/S,LSHIFT=LS/S,
RSHIFT=RS/S,UNIFY=UN/S,CONV8+3=8+3/S,RENUMBER=RN/K,UPTO=UT/K,STEP=ST/N,PLACES=PL/N,
INVERT=IV/S,BASENAME=BN/S,NUMBERPOS=NP/N,PREFIRST=PF/S,SELECTED=SE/S,SIMULATE=SM/S,
NOPROGRESS=NOP/S,QUIET=Q/S


Short description of the keywords :


          FROM <string(s)> : filename(s) to rename

               TO <string> : new string that replaces the selected characters,
                             and/or destination path

                  SAMEPATH : reuse the source path as the destination path
                             if the second isn't given

                       ALL : set full recursion

           RLEVEL <number> : set the maximum level of recursion

           SLEVEL <number> : set the starting level of recursion

           DIRPAT <string> : match pattern for entering directories

              GLOBALDIRPAT : make the DIRPAT pattern be used beyond the
                             starting level of recursion

                     FILES : only files are renamed

                      DIRS : only directories are renamed

                     ICONS : rename .info files automatically

           DOT <character> : set the separator of prefix,main,suffix

       WSEP <character(s)> : set the separator of words

                   COMMENT : select the comment of the filename

                    PREFIX : select the prefix

                      MAIN : select the main part

                    SUFFIX : select the suffix

  WORD <number>,[<number>] : select the specified word

          INCLSEP <number> : also select the word's separating chars

  LEFT <number>,[<number>] : select characters from the left

 MID [<number>],[<number>] : select characters in the middle

 RIGHT <number>,[<number>] : select characters from the right

            MATCH <string> : select the part that matches the string

               DO <number> : number of matches to perform

             SKIP <number> : number of matches to skip before starting

                    BEFORE : select the characters before the matched segment

                     AFTER : select the characters after the matched segment

                  REVMATCH : check for matches from the end of the filename

                   EXCLUDE : invert the selection process

                       ADD : allow the creation of prefix, main or suffix
                             components even if they don't already exist.

                  CASESENS : enable case-sensitive matching

                TOFILENAME : redirect the result to the filename

                 TOCOMMENT : redirect the result to the comment

                     UPPER : make the selected characters uppercase

                     LOWER : make the selected characters lowercase

                UPAFTERSPC : make uppercase the character after a space

           INSERT <string> : insert a string into the filename

               AT <number> : set the position for the string to insert

                    UPDATE : insert a string only if it does not exist in the
                              specified position

                    DELETE : delete the selected characters

                      SWAP : swap the selected segments

                    LSHIFT : shift filename segments to the left

                    RSHIFT : shift filename segments to the right

                     UNIFY : unify the selected segments

                   CONV8+3 : convert to MS-DOS filename format

         RENUMBER <number> : renumber a filename sequence to start with the
                             given number

 UPTO <number or filename> : set the ending filename in renumbering actions

             STEP <number> : set the renumber step value

           PLACES <number> : set the renumber number-format

                    INVERT : perform inverted renumbering

         BASENAME <string> : select the basename for modification

        NUMBERPOS <number> : set the position of the number within the
                             basename

                  PREFIRST : set the prefix component first

                  SELECTED : just show which files will be renamed

                  SIMULATE : simulate renaming

                NOPROGRESS : don't show progress output in recursion

                     QUIET : don't show any output


A detailed description of the above keywords can be found below. Most keywords
have an abbreviation which is the one in parentheses after their full name.





FILE/DIRECTORY SELECTORS


The following keywords define which files or directories will be selected for
renaming according to their name or comment, file or dir status, directory tree
level, and the directory that they are in.

FROM
ALL
RLEVEL
SLEVEL
DIRPAT
GLOBALDIRPAT
FILES
DIRS
ICONS
COMMENT



FROM <filename(s)> :


The given file(s) or dir(s) are renamed. If just a directory or volume is
supplied, all its files are renamed. If instead of a filename, a pattern
(wild-card) is given, only files or dirs that match this pattern will be
renamed.
Multiple patterns can be supplied. Note that you don't actually have to type
FROM in the command line.

Examples:
> SRename C LW : Make C lowercase regardless of type (file or dir)

> SRename C/ LW : Make all files and dirs in C lowercase

> SRename C:d#? UP : Make all files and dirs in C that begin with "d" uppercase



ALL :


Sets full recursion. All directories in the directory tree will be entered.
It is overridden by RLEVEL and can also be set by GLOBALDIRPAT.

Example:
> SRename SYS:Games/a*#? LW ALL : Make all files in SYS:Games that begin with "a"
lowercase in all subdirectories.



RLEVEL (RL) <recursion level value> :


Sets the level of recursion. If this is 1 only subdirectories in the current
directory will be entered.
The default recursion level is 0 (no recursion).

Example:
> SRename SYS:Games/a*#? LW RL 3 : Make all files in SYS:Games that begin with
"a" and in subdirectories up to 3 levels deep lowercase.



SLEVEL (SL) <starting level value> :


Sets the starting level of recursion. Files and directories in a tree level
lower than the specified will not be entered. Also sets full recursion if a
RLEVEL parameter is not given. The default starting level is 1.
Note that the value of SLEVEL can not be greater than the value of RLEVEL.

Example:
> SRename SYS: UP SL 2 : Make all filenames in SYS: uppercase, except for the
filenames in the root directory.



DIRPAT (DP) <wildcard pattern> :


Determines which directories in a given path are to be entered to rename their
contents according to the specified pattern.
This parameter implies that recursion is active, if not it sets the level of
recursion to 1.
Note that the DIRPAT pattern is used only once for the directories that exist
in the directory that renaming begins.
If you want the DIRPAT pattern to be used all the way when recursing you must
give the GLOBALDIRPAT keyword.

Examples:
> SRename SYS:Data/#?z DP project#? DL SU : Remove the suffix from all the
filenames in SYS:Data that end with "z" and from the filenames in the
subdirectories of SYS:Data that begin with "project".

> SRename SYS:Data/#?z DP project#? DL SU RC : Same as the previous example but
acts on filenames in all subdirectories that are contained in directories that
begin with "project".



GLOBALDIRPAT (GD) :


Makes the DIRPAT pattern be used with all directories that are encountered,
not just with those in the starting level. A directory is entered for renaming
to take place, only if it matches the DIRPAT pattern.
GLOBALDIRPAT sets full recursion if a RLEVEL parameter is not given.

Examples:
> SRename SYS:Data/#?z DP project#? DL SU GD : Remove the suffix from all
the filenames in SYS:Data that end with "z" and in all subdirectories of
SYS:Data that begin with "project".

> SRename SYS:Data/#?z DP project#? DL SU RL 2 : same as the previous
example but only acts on subdirectories of SYS:Data that begin with "project"
in a depth of up to 2 levels.



FILES (FL) :


Only files are renamed, directory names are not touched.

Example:
> SRename Work/Data/ UP FL : Make all the filenames in Work/Data uppercase.
Directory names are not renamed.



DIRS (DR) :


Only directories are renamed, the names of files are not touched.

Example:
> SRename Work/Data LW DR : Make all the dirnames in Work/Data lowercase.
Filenames are not renamed.

Note: if both FILES and DIRS are given only FILES will remain active.



ICONS (IC) :


When in single or multiple filename mode or in numbering or renumbering mode
this keyword makes the icon files (".info" files) to be renamed automatically
even if they weren't specified in the filename list.
Note that the way this option works is that the icon gets exactly the same
filename that was given to the file that the icon accompanies.
The icon's filename itself is not taken into account.
If the file of the accompanying icon couldn't be found then the icon's filename
will not be modified.
ICONS can also be used with wildcards. When this happens the wildcard pattern
is modified so that it will exclude icon filenames so that icon filenames will
not be modified twice.

Examples:
> SRename tools/lacer tools/prepcard UP IC : Make "lacer" and "prepcard"
uppercase including their icon's filenames.

output:
"lacer" renamed as "LACER"
"lacer.info" renamed as "LACER.info"
"prepcard" renamed as "PREPCARD"
"prepcard.info" renamed as "PREPCARD.info"

> SRename tools/p#? UP IC : Make all filenames starting with "p" and their
icon's filenames uppercase.

output:
"PrintFiles" renamed as "PRINTFILES"
"PrintFiles.info" renamed as "PRINTFILES.info"
"PrepCard" renamed as "PREPCARD"
"PrepCard.info" renamed as "PREPCARD.info"

> SRename picture1 RN 10 IC : Renumber files from picture1 and up including
their icons.

output:
"picture1" renamed as "picture10"
"picture1.info" renamed as "picture10.info"
"picture2" renamed as "picture11"
"picture2.info" renamed as "picture11.info"
"picture3" renamed as "picture12"
"picture3.info" renamed as "picture12.info"
   .... 



COMMENT (CO) :


This is a special selector that makes SRename select the filename's comment
for modification instead of the filename itself.
All the other selectors and actions can then be applied to the comment and the
result of the modification will go to the filename's comment unless it is
redirected by the TOFILENAME keyword.
None of the renumbering actions however can be used with COMMENT.
Using COMMENT with such an action will be the same as using the TOCOMMENT
keyword.

Examples:
> SRename pic.iff CO UP : Make the comment of "pic.iff" uppercase.
output:
Comment of "pic.iff" changed from "created with lightwave" to "CREATED WITH
LIGHTWAVE"

> SRename Data:pics/ CO DL : Delete all the comments from the filenames in the
Data:pics/ directory.

> SRename roms/ CO MT "MAME" TO "M.A.M.E." : Replace all occurences of "MAME"
in the comments of the filenames in roms with "M.A.M.E."






REDIRECTION KEYWORDS


The following keywords redirect the resulting filename to the file's comment
or the resulting comment to the filename, or they can send the result of the
modification to both the filename and the file's comment.

TOFILENAME
TOCOMMENT



TOFILENAME (TF) :


This keyword is implied when performing filename renaming. It's main purpose
is to redirect the modified or unmodified comment to the filename instead.
If the user wants the current comment to be modified as well as the filename
then the TOCOMMENT keyword must also be given.
If a filename's comment contains characters that denote a path then only the
filename part of the comment will go to the filename.

Examples:
> SRename sample.iff CO TF : "sample.iff" will be renamed as it's comment.
output:
"sample.iff" renamed as "created with SFX"

> SRename sample.iff CO UP TF TC : Makes the comment of "sample.iff" uppercase
and will also use it to rename "sample.iff".
output:
Comment of "sample.iff" changed from "created with SFX" to "CREATED WITH SFX"
"sample.iff" renamed as "CREATED WITH SFX"



TOCOMMENT (TC) :


This keyword is implied when modifying filename comments. It's main purpose is
to redirect the modified or unmodified filename to the comment instead.
If the user wants the filename to be modified as well as the comment then the
TOFILENAME keyword must also be given.

Note that when both TOFILENAME and TOCOMMENT are given with the ICONS keyword
then only the filenames of icons is modified and not their comments.
Files other than icons will get both their filename and comment modified in
such a case.

Examples:
> SRename brush1.bsh SU TO iff TF TC : Puts "iff" to the filename suffix and
also copies the new filename to the comment.
output:
Comment of "brush1.bsh" changed from "" to "brush1.iff"
"brush1.bsh" renamed as "brush1.iff"

> SRename brush1.bsh TC : Copies the filename to the comment.
output:
Comment of "brush1.bsh" changed from "" to "brush1.bsh"






CHARACTER SELECTORS(in order of evaluation)


The following keywords define which parts of the filename will be affected by
the action keywords that will be given. The selection can be done according to
the position of the characters or the characters themselves.

BASENAME
PREFIX
MAIN
SUFFIX
WORD
MATCH
LEFT
MID
RIGHT
EXCLUDE



BASENAME (BN) :


Selects the basename of a filename sequence for modification. This selector
activates the renumbering mode and is described in detail in the renumbering
section.



PREFIX (PR) :


Selects the prefix (leftmost part) for modification.



MAIN (MA) :


Selects the main part (middle part) for modification.



SUFFIX (SU) :


Selects the suffix (rightmost part) for modification.


These filename components are separated by a dot "." by default but this can
be changed with the use of the DOT keyword.
Specifying more than one of the above selectors does not cancel the other.
Note that if SRename receives a filename with only two components it regards
that the filename has no prefix.
New prefix, main or suffix components are not created by default if they don't
already exist but this can be overridden with the ADD keyword.
The prefix component is filled only if the filename has 3 or more components,
or with 2 components if PREFIRST is specified, which forces prefix-main to be
filled instead of main-suffix.

Here are some examples on how different filenames fill the PREFIX-MAIN-SUFFIX
components:


 FILENAME              PREFIX              MAIN             SUFFIX 

 test                  -empty-             test             -empty-

 001.test.pic.gif       001                test.pic          gif

 test.pic.gif           test               pic               gif

 001.test              -empty-             001               test

 001.test PREFIRST      001                test             -empty-


Examples:
> SRename Work:#? SU ilbm : Replaces the contents of the suffix of
every filename in Work: with "ilbm", if they have a suffix.

> SRename files/backup.lzx MA UP : Makes the main component uppercase.
output:
"backup.lzx" renamed as "BACKUP.lzx"

> SRename mod.techno PR UP PF : Forces PREFIX to be filled before SUFFIX and
makes the prefix uppercase.
output:
"mod.techno" renamed as "MOD.techno"

> SRename TheLastBallad.s3m SU UP : Makes the suffix uppercase.
output:
"TheLastBallad.s3m" renamed as "TheLastBallad.S3M"



WORD (WD) <starting word number>,[number of words to select] :


Selects a word within the filename. A word is determined by spaces by default,
unless the word separator is changed with the WSEP keyword.
Words are selected from the start of the filename unless the starting word
number is negative.
For example WORD -1 selects the last word of the filename.
If the second parameter is also given then consecutive words can be selected.
Note that WORD is evaluated after PREFIX/MAIN/SUFFIX and before MATCH and
LEFT/MID/RIGHT, so you can't select a filename part with MATCH or LEFT/MID/
RIGHT and then select a word within that part, but you can select a word
within PREFIX/MAIN/SUFFIX.

Examples:
> SRename "screen grab of game" WD 1 UP
output:
"screen grab of game" renamed as "SCREEN grab of game"

> SRename "Letter to john" WD -1 UP
output:
"Letter to john" renamed as "Letter to JOHN"

> SRename "screen grab of game" WD 1,2 UP
output:
"screen grab of game" renamed as "SCREEN GRAB of game"

> SRename Data:Pics/ MA WD 1 UP : Makes uppercase the first word in the main
part of the filename.

> SRename Data:Pics/ MA WD 1 L 1 UP : Makes uppercase the first character of
the first word in the main part of the filename.



MATCH (MT) [:][/]<string(s)> :


Selects the characters that match the supplied string(s).
If the string to match is preceded by a colon ":" then single character mode
is activated and the supplied string is treated as individual characters.

Example:
> SRename Pics/ MT :[]{}()<>#@ DELETE : Remove all []{}()<>#@ characters from
the filenames in Pics.

If the match string begins with a slash "/" then character code mode is
activated, and single or multiple comma separated ASCII codes or single
characters should follow.

Example:
> SRename Data/ MT /42,> DELETE : Remove all "*" and ">" characters from the
filenames in "Data".

In this mode you can also select character ranges by supplying two characters
or their ASCII codes which should be separated by a minus sign "-", or just
the starting or ending character or ASCII code.
Note that if you want to specify a range that starts lower than 10, whatever
reason should you have to do that, then you must supply a leading zero before
the number so that it won't be a single character, as single characters supply
their ASCII value even if they are numeric (The ASCII code of "0" is 48).

Examples:
> SRename Data/ MT /160-,48-57 DELETE : Remove all characters with ASCII codes
same as or greater than 160, and ASCII codes 48 to 57 (digit characters).

> SRename Data/ MT /-.,0-9,~- TO _ : Replace with "_" all characters before "."
including it, from "0" to "9", and after "~" including it.

If none of the above modes are active then normal string matches are performed.
Multiple strings to match can be supplied by using "|" as a separator.
The matching is case insensitive by default unless CASESENS is also given,
and the supplied string cannot be a wild card.
Note that CASESENS has no effect in character code mode.

The MATCH selector is very powerful and in conjunction with the DO, SKIP,
BEFORE, AFTER and REVMATCH keywords which are used only with MATCH and are
described below, and with the LEFT-MID-RIGHT selectors, it can select any part
of the filename relative to the matched string.
Using BEFORE or AFTER complicates things a bit for MATCH because selected
character ranges can overlap, and changes in one selected range can affect the
next selected range in the way that it will be selected and in the way it will
be modified.
To ensure that the intended characters by the user are selected, the MATCH
selector corrects both the selected character range length and position.
For example if two selected character ranges overlap, and new characters were
inserted within the overlapping range, then the length of the second character
range is adjusted so that all the intended characters are selected.

Examples:
> SRename SYS: MT pic TO picture : Replace all occurrences of "pic" with
"picture" in all the filenames in the root dir of SYS:

> SRename Work: MT exe|lib UP : Make every occurrence of "exe" and "lib"
uppercase in all the filenames in the root dir of Work:



LEFT (L) <number of chars>,[<left offset>] :


Selects characters from the left side of the filename.



MID (M) [<left offset>],[<right offset>] :


Selects characters using the distance from the left and right edge of the
filename.



RIGHT (R) <number of chars>,[<right offset>] :


Selects characters from the right side of the filename.


Left/right offset specifies the number of characters from left/right to skip
before selecting the number of characters given in the first parameter.
Note that PREFIX/MAIN/SUFFIX are evaluated before LEFT/MID/RIGHT.
This means that you cannot for example select the 8 rightmost characters of a
file/dirname and then select the main component in them (if there is one).

For example: SRename newfilename.suf R 8 MA UP would not select the characters
"name" but would rather select the characters "filename" as MAIN is evaluated
before RIGHT.
Also if more than one component of a filename is selected, any specified
actions will take place on the selected components separately.

For example: SRename 001.testpic.jpeg MA SU L 1 UP would make uppercase the
leftmost character in MAIN, and then in SUFFIX (001.Testpic.Jpeg) and not the
leftmost character of MAIN and SUFFIX combined (001.Testpic.jpeg).

Examples:
> SRename Libs:datatypes.library L 1 UP
output:
"datatypes.library" renamed as "Datatypes.library"

> SRename Work:001picture R 1,6 UP
output:
"001picture" renamed as "001Picture"

> SRename DataPartition_backup M 4,7 Volume
output:
"DataPartition_backup" renamed as "DataVolume_backup"



EXCLUDE (XC) :


This keyword makes SRename not to modify the selected characters but those that
haven't been selected. Note that it does not invert the selection that has been
made by the PREFIX/MAIN/SUFFIX selectors, and that it makes the exclusion after
all the selectors that have been given have acted.
If for example you have used the WORD and MATCH selectors and EXCLUDE, then
you can't exclude a part with WORD and then act on the excluded parts with
MATCH, because EXCLUDE will act after both WORD and MATCH will have selected
some parts of the filename.
Also note that when EXCLUDE is given with MATCH in single character or in
character code mode then the parts that are excluded are modified as single
characters and not as strings.

Examples:
> SRename asmallfile MT small UP XC
output:
"asmallfile" renamed as "AsmallFILE"

> SRename editorprefs L 6 UP XC
output:
"editorprefs" renamed as "editorPREFS"





KEYWORDS USED BY CHARACTER SELECTORS


The following keywords are used by various character selectors so they shouldn't
be given without their relevant character selector.

INCLSEP
WSEP
DO
SKIP
REVMATCH
BEFORE
AFTER
CASESENS
ADD
DOT



INCLSEP (IS) <number> : (used by WORD)


Makes the WORD selector to include the separating characters that are left or
right of the word to select. The supplied number can be 1 or 2 and designates
what separating characters should be included.
1 means that the separating characters of only one side of the word will be
included: the right side. If there aren't any on the right side then the
characters on the left side will be included.
2 means that the separating characters on both sides will be included if they
exist.
This keyword has been included mainly to aid in the deleting of words.
Without INCLSEP the WORD selector will select the exact word that is told to,
and in case that word is to be deleted the spaces next to that word will remain.

For example:
> SRename "Bin:Picture of a ship" WD 3 DL
output:
"Picture of a ship" renamed as "Picture of ship"
As you see there are two spaces between "of" and "ship" instead of one that
would be normal. If you use INCLSEP 1 you will have:

> SRename "Bin:Picture of a ship" WD 3 IS 1 DL
output:
"Picture of a ship" renamed as "Picture of ship"
Now the WORD selector selects "a " instead of "a" for deletion.

If you use INCLSEP 2 you will have:

> SRename "Bin:Picture of a ship" WD 3 IS 2 DL
output:
"Picture of a ship" renamed as "Picture ofship"
Now WORD selected " a " for deletion.



WSEP (WS) <char(s)> : (used by WORD)


Defines the word separator that will be used by the WORD selector to pick up
words. This is a space character by default.
This separator can be more than one character if this is really needed.

Example:
> SRename Letter_to_john WD 3 UP WS _
output:
"Letter_to_john" renamed as "Letter_to_JOHN"



DO <number of matches to perform> : (used by MATCH)


Determines the maximum number of matches that will be attempted by the MATCH
selector. The supplied numeric value should be at least 1, as a value of 0
will not result in making no matches.

Example:
> SRename -new-text-file MT - TO _ DO 2: Only the first 2 occurrences of "-"
will be replaced with "_".
output:
"-new-text-file" renamed as "_new_text-file"



SKIP (SK) <number of matches to skip> : (used by MATCH)


Determines the number of matches that will be skipped before any matches can
be performed.

Example:
> SRename -new-text-file MT - TO _ SK 1: Only the occurrences of "-" after the
first will be replaced.
output:
"-new-text-file" renamed as "-new_text_file"



REVMATCH (RM) : (used by MATCH)


Makes the matching process to start from the end of the filename, instead of
the start.

Example:
> SRename -new-text-file MT - TO _ DO 1 RM : Only the last occurrence of "-"
will be replaced.
output:
"-new-text-file" renamed as "-new-text_file"



BEFORE (BF) : (used by MATCH)


Selects the characters before the matched string. If you want to select a
limited amount of characters before a string, you should use the RIGHT selector.
Note that if you use BEFORE without RIGHT to select all characters before the
matched string and start the match from the right with REVMATCH only one match
will be performed, even if more than one strings to match exist.

Examples:
> SRename lastletter MT letter BF UP : Makes uppercase all characters before
"letter".
output:
"lastletter" renamed as "LASTletter"

> SRename gamescreengrab MT grab BF R 6 UP : Makes uppercase 6 characters
before "grab".
output:
"gamescreengrab" renamed as "gameSCREENgrab"



AFTER (AF) : (used by MATCH)


Selects the characters after the matched string. If you want to select a
limited amount of characters after a string you should use the LEFT selector.
Note that if you use AFTER without LEFT and without REVMATCH to select all
characters after the matched string only one match will be performed even if
more than one strings to match exist.

Examples:
> SRename lastletter MT last AF UP : The characters after "last" will be made
uppercase.
output:
"lastletter" renamed as "lastLETTER"

> SRename "the last ballad" MT " " AF L 1 UP : This is equivalent to uppercase
after space, with the exception that it does not uppercase the first character.
output:
"the last ballad" renamed as "the Last Ballad"

> SRename readmenow MT read AF L 3,2 UP : Makes uppercase 3 characters after
the end of "read" plus 2 characters.
output:
"readmenow" renamed as "readmeNOW"



CASESENS (CS) :


Makes string matching case sensitive. The default is case insensitive.
This keyword can be used in conjunction with the MATCH selector, the UPDATE
action, and any of the renumbering actions.
It's function in renumbering is a little different than in MATCH and in
UPDATE so refer to the renumbering section's description of CASESENS for
details.

Example:
> SRename FileNamewithname MT name TO Comment CS
output:
"FileNamewithname" renamed as "FileNamewithComment"

Note that only the second occurrence of "name" is replaced with "Comment"
because the string matching is case sensitive.



ADD (AD) : (used by PREFIX,MAIN,SUFFIX)


If this keyword is given then the specified component (PREFIX, MAIN, SUFFIX) can
be created even if it didn't previously exist.

Example:
> SRename SoundSample SU TO 8SVX
output:
"SoundSample" not changed

> SRename SoundSample SU TO 8SVX AD
output:
"SoundSample" renamed as "SoundSample.8SVX"

A new suffix was not appended to the filename in the first case because it didn't
already exist, but in the second case this doesn't matter.



DOT <character> : (used by PREFIX,MAIN,SUFFIX)


Redefines the separator character. The default separator is a period (.)
The separator character determines the PREFIX, MAIN and SUFFIX components.

Example:
> SRename archive_tar_gz MA SU UP DOT _
output:
"archive_tar_gz" renamed as "archive_TAR_GZ"






ACTION KEYWORDS


The following keywords determine how the parts of the filename that have been
selected with the character selectors will be modified. If no selectors have
been given then the whole filename will be modified.

TO
UPPER
LOWER
UPAFTERSPC
INSERT
DELETE
SWAP
LSHIFT
RSHIFT
CONV8+3
UNIFY



TO (AS) <[path/]filename> :


Replaces the selected portion of the filename with the given string.
It can also be used to move files to other directories in the same volume
(AmigaOS Rename function limitation) if a path is supplied.
The TO keyword need not be given if no other action keywords are supplied
because in such a case the last given filename activates the TO action.
TO can also accept empty strings ("") as a parameter. In this case the filename
is left unchanged but the file will be moved to the current directory if it is
in the same volume as the file.
To obtain compatibility with the OS Rename command the destination path is no
longer inherited from the source path if the first isn't given by the user.
To enable the above feature the SAMEPATH keyword must be given.
Note that this keyword can also be used for the numbering of filenames, look
at the numbering section for details.

Examples:
> SRename OldFileName L 3 New
output:
"OldFileName" renamed as "NewFileName"

> SRename TestFile NewDir/ : Moves "TestFile" to "NewDir".

> SRename TestFile NewDir/NewName : Moves "TestFile" to "NewDir" and
renames it as "NewName".

> SRename TestFile "" : Moves "TestFile" to the current directory.



UPPER (UP) :


Makes the selected characters uppercase. It is Keymap sensitive so that it will
function correctly with any keymap-font setup.

Example:
> SRename Data/ L 1 UP : Makes uppercase the first character of every filename
in Data directory.

> SRename Data/ SU UP : Makes uppercase only the suffix of every filename in
Data directory.



LOWER (LW) :


Makes the selected characters lowercase. It is Keymap sensitive so that it will
function correctly with any keymap-font setup.

Example:
> SRename Data/TEXTFILE LW
output:
"TEXTFILE" renamed as "textfile"



UPAFTERSPC (US) :


Makes characters after spaces uppercase. It also makes uppercase the first
character in the selected range. This is not purely an action as it encapsulates
character selection.
It has been designed this way because if making uppercase the character after a
space was done using MATCH " " AFTER LEFT 1 UP, then the first character wouldn't
be made uppercase as it would be desired.

Example:
> SRename "Data/text file" US
output:
"text file" renamed as "Text File"



INSERT (IN) <string> :


Inserts the given string at the beginning of the selected characters.
You can make the insertion anywhere within the filename by using the AT
keyword. This action can also be used for the numbering of filenames, look at
the numbering section for details.

Example:
> SRename Letter.txt IN First
output:
"Letter.txt" renamed as "FirstLetter.txt"



DELETE (DL) :


Removes the selected characters from the filename.

Examples:
> SRename SYS: L 3 DL : deletes the first 3 characters from filenames in SYS:

> SRename SYS: SU DL : deletes the suffix from filenames in SYS:

> SRename SYS: MT :#@ DL : deletes every "#" and "@" character from filenames
in SYS:



SWAP (SW) :


Swaps the selected filename components. If 2 of the PREFIX, MAIN, SUFFIX
selectors are given, then the parts specified by these selectors will be
swapped. Otherwise if none of the above selectors are given or all of them
then just the 2 extreme components are swapped.
SWAP has an effect only on filenames with at least 2 components, like prefix-
main, main-suffix, or all (prefix-main-suffix).

Examples:
> SRename picture.iff SW
output:
"picture.iff" renamed as "iff.picture"

> SRename 001.picture.iff SW
output:
"001.picture.iff" renamed as "iff.picture.001"

> SRename 001.picture.iff PR MA SW
output:
"001.picture.iff" renamed as "picture.001.iff"



LSHIFT (LS) :


Shifts the filename components to the left, the leftmost becomes the rightmost.
Like SWAP it has an effect only on filenames with at least 2 components.
This keyword operates on the whole filename so the component selectors have
no effect with it.

Example:
> SRename SYS:001.picture.iff LS
output:
"001.picture.iff" renamed as "picture.iff.001"



RSHIFT (RS) :


The opposite of LSHIFT. The rightmost component becomes the leftmost. It has an
effect only on filenames with at least 2 components. Like LSHIFT it also operates
on the whole filename so the component selectors have no effect with it.

Example:
> SRename SYS:001.picture.iff RS
output:
"001.picture.iff" renamed as "iff.001.picture"



CONV8+3 (8+3) :


Converts filenames to the MS DOS format of 8+3 characters. The filename will be
made uppercase, if it has a suffix this will be cut to 3 characters in length,
and if it has a prefix it will only be maintained if there is room left from
the main component.
Note that none of the selector keywords have any effect with this keyword,
because it always operates on the whole filename.
It is possible when converting whole directories that some filenames will fail
to be converted because they may get the same name with other files.
For example picture-1.iff and picture-2.iff will both receive the name:
PICTURE-.IFF

Examples:
> SRename SYS:User.prefs 8+3
output:
"User.prefs" renamed as "USER.PRE"

> SRename SYS:sound.sample.iff 8+3
output:
"sound.sample.iff" renamed as "S_SAMPLE.IFF"



UNIFY (UN) :


Unifies the filename components specified by PREFIX, MAIN, SUFFIX by deleting the
separator character. If no component is specified then it unifies the whole
filename.
Note that unifying the main part is a little different than unifying the prefix
or suffix. Unifying the prefix or suffix causes the separator between them and
the main part to be deleted, whereas unifying the main part will remove from it
any separator characters that it main contain.

Examples:
> SRename SYS:picture.001 UN
output:
"picture.001" renamed as "picture001"

> SRename SYS:001.picture.iff UN PR
output:
"001.picture.iff" renamed as "001picture.iff"

> SRename SYS:001.some.complex.name.iff UN MA
output:
"001.some.complex.name.iff" renamed as "001.somecomplexname.iff"






KEYWORDS USED BY ACTIONS


The following keywords are used by a couple of actions so they should only
be given with them.

SAMEPATH
AT
UPDATE



SAMEPATH (SP) : (used by TO)


This keyword makes the source path to be reused as the destination path if
the second isn't given. This frees the user from having to enter long paths
twice.
This keyword only has effect with the TO keyword, or when TO is not given but
implied, and when no selectors are given.

Example:
> SRename Pics/Raytraced TO Rendered : The file will be renamed but will also
be moved to the current directory.

> SRename Pics/Raytraced TO Rendered SP : Now the file does not move to the
current directory but stays at the "Pics" directory even though no destination
path is given.



AT <character position> : (used by INSERT)


Sets the position within the filename at which the string that was given with
INSERT is to be placed.
If the numeric value given with AT is negative then the character position is
measured from the right and not from the left. This is to allow AT to append
a string at the end of a filename.
Note that if the absolute value of the given character position is larger than
the length of the filename plus 1, then no insertion will take place.

For example: "SRename afile IN name AT 7" will have no effect as no insertion
will be performed.

Examples:
> SRename AnyFilename IN XYZ AT 4
output:
"AnyFilename" renamed as "AnyXYZFilename"

> SRename Sound IN Sample AT -1
output:
"Sound" renamed as "SoundSample"



UPDATE (UD) : (used by INSERT)


Allows the INSERT action to proceed only if the string to insert does not exist
in the specified position.
The characters that are compared with the string to insert, are after the
specified position in insert mode and before the specified position in append
mode. The comparison is case insensitive unless CASESENS is given.

Examples:
> SRename old_letter.txt IN Old UD : Because "old" already exists in the
beginning of the filename it is not inserted.
output:
"old_letter.txt" not changed

> SRename old_letter.txt IN Old UD CS : Now "Old" is inserted because the
comparison is case sensitive.
output:
"old_letter.txt" renamed as "Oldold_letter.txt"

> SRename pic_last.iff IN Last AT -5 UD : Trying to insert "last" in the 5th
character from the end fails because it already exists.
output:
"pic_last.iff" not changed

> SRename Sound.iff IN Sample AT -5
output:
"Sound.iff" renamed as "SoundSample.iff"






RENUMBERING


SRename can perform intelligent renumbering of filename sequences in one go.
It is not limited in the formats it can support, as it scans the filenames for
numbers of up to 9 digits long, which can have leading zeros, and can be in
any position in the filename, or on their own.
You don't have to specify the order of renaming, normal or reverse, as with
other renumbering utilities, because it scans the filenames in the directory and
decides which way to go.
Furthermore you don't have to worry for filename clashes during renumbering,
as any clashes will be found before the actual renaming begins, and the
clashing filenames will be given temporary names, before are finally renamed.
Inverting the numbers in a sequence can also be performed, a feature that would
be useful in compiling ping-pong animations.

The following keywords are used in renumbering and can be given all at once,
or on their own : 

RENUMBER
UPTO
STEP
PLACES
INVERT
BASENAME
NUMBERPOS
CASESENS



RENUMBER (RN) <new starting number> :


Specifies the new starting number of a filename sequence. All matching
filenames will be renumbered unless an ending number is specified with UPTO.

Examples:
> SRename Data:picture001 RN 50 : will renumber all filenames that begin with
"picture" and have a number attached at the end, to values starting with 50.
The leading zeros will be preserved.

output:
"picture001" renamed as "picture050"
"picture002" renamed as "picture051"
"picture003" renamed as "picture052"
"picture004" renamed as "picture053"
"picture005" renamed as "picture054"
   ....

> SRename Data:picture001 RN 50 UT 4 : as above but will renumber up to
filename "picture004".

output:
"picture001" renamed as "picture050"
"picture002" renamed as "picture051"
"picture003" renamed as "picture052"
"picture004" renamed as "picture053"

> SRename Data:10.frame RN 020 : will renumber all filenames that end in
".frame" and are preceded with a value of 10 or greater, to values starting
with 020.

output:
"10.frame" renamed as "020.frame"
"11.frame" renamed as "021.frame"
"12.frame" renamed as "022.frame"
"13.frame" renamed as "023.frame"
"14.frame" renamed as "024.frame"
   ....

Note that when you supply a new starting number with leading zeros,
the old number format is overridden.



UPTO (UT) <number or filename> :


Specifies the filename up to which the given renumbering actions will be
performed. It can either accept the number of the ending filename or the ending
filename itself so that people that use SRename from a file manager like
Directory Opus don't have to enter the ending number with the keyboard but can
select the starting and ending filenames from the lister instead.
It doesn't matter if the filename given to UPTO contains a path or not.
If you give this keyword you must specify at least one renumber-type action
(RENUMBER, STEP, PLACES, BASENAME+action, NUMBERPOS or INVERT) with it
otherwise a "Required argument missing" error will occur.

Examples:
> SRename Data:picture001 RN 50 UT 6 : will renumber from "picture001" up to
"picture006".

> SRename Data:frame100 UT frame110 BN TO AnimFrame : will change the basename
from "frame100" up to "frame110".



STEP (ST) <step value> :


Defines the increment value of renumbering. The default increment is 1.
It can also take negative values.

Examples:
> SRename Data:picture001 RN 30 ST 2 : increases the new starting value by 2.

output:
"picture001" renamed as "picture030"
"picture002" renamed as "picture032"
"picture003" renamed as "picture034"
"picture004" renamed as "picture036"
  ....

> SRename Data:picture001 ST 3 : will keep the original starting value, but
will increase the destination numbers in steps of 3 :

output:
"picture004" renamed as "picture010"
"picture003" renamed as "picture007"
"picture002" renamed as "picture004"
"picture001" not changed
  ....

Note that the renumbering is executed in reverse order to avoid a clash when
renaming "picture002" to "picture004" ("picture004" already exists).



PLACES (PL) <places value> :


Sets the number format of the destination filenames. This affects the number of
leading zeros the numbers will have.
If you specify a places value that is smaller than the digits a number already
has, that number will be unaffected. Any numbers will less digits than the
places value will be padded with leading zeros.

Examples:
> SRename Data:picture001 RN 30 PL 4 : makes the numbers 4-digit.

output:
"picture001" renamed as "picture0030"
"picture002" renamed as "picture0031"
"picture003" renamed as "picture0032"
"picture004" renamed as "picture0033"
  ....

> SRename Data:picture001 PL 1 : strips all leading zeros from the numbers.

output:
"picture001" renamed as "picture1"
"picture002" renamed as "picture2"
"picture003" renamed as "picture3"
"picture004" renamed as "picture4"
  ....

> SRename Data:picture001 UT 3 PL 2 : will renumber from number 001 to 003,
and make the numbers 2-digit.

output:
"picture001" renamed as "picture01"
"picture002" renamed as "picture02"
"picture003" renamed as "picture03"



INVERT (IV) :


Invert the numbers in a filename sequence. This is exactly how inverting works:

         Original filenames               New filenames

             file.10       -> becomes ->     file.14
             file.11       -> becomes ->     file.13
             file.12                     - not changed -
             file.13       -> becomes ->     file.11
             file.14       -> becomes ->     file.10

You may have noticed that executing this sequence of rename commands has a
problem: how can "file.10" become "file.14" when "file.14" already exists.
SRename sees that and when destination filenames already exist, the files to
be renumbered are given temporary filenames until the existing filenames
themselves have been renumbered, so after this is done the temporary filenames
are given their normal destination filenames.
A non-resolvable error occurs ("New number already exists" error) if these
existing filenames that cause clashes are not scheduled to be renumbered
because they are outside the range of files to be renumbered.

Examples:
> SRename Data:file100 IV : inverts the whole filename sequence.

output:
"file100" renamed as "109.srtemp861A5BC"
"file101" renamed as "108.srtemp861A5BC"
"file102" renamed as "107.srtemp861A5BC"
"file103" renamed as "106.srtemp861A5BC"
"file104" renamed as "105.srtemp861A5BC"
"file105" renamed as "file104"
"file106" renamed as "file103"
"file107" renamed as "file102"
"file108" renamed as "file101"
"file109" renamed as "file100"
"109.srtemp861A5BC" renamed as "file109"
"108.srtemp861A5BC" renamed as "file108"
"107.srtemp861A5BC" renamed as "file107"
"106.srtemp861A5BC" renamed as "file106"
"105.srtemp861A5BC" renamed as "file105"

Notice how numbers 100 to 104 are given temporary filenames before been finally
renumbered, because of clashes that would occur during the renaming process.

> SRename Data:file100 RN 50 IV : inverts the filename sequence and gives it
a starting number of 50.

output:
"file100" renamed as "file59"
"file101" renamed as "file58"
"file102" renamed as "file57"
"file103" renamed as "file56"
"file104" renamed as "file55"
"file105" renamed as "file54"
"file106" renamed as "file53"
"file107" renamed as "file52"
"file108" renamed as "file51"
"file109" renamed as "file50"



BASENAME (BN) :


Selects the basename of a sequence for modification. Every available action
can be applied to the basename with the exception of CONV8+3 action which
wouldn't be very useful if applied to a basename because the complete filenames
would exceed 11 characters as the numbers would also be included.

After the basename has been modified the position of the number within the
basename is calculated automatically according to the characters that have been
inserted to or deleted from it, unless the number position is set manually with
the NUMBERPOS keyword.
if the basename has components (prefix-main-suffix) and these are reorganised
with SWAP, RSHIFT or LSHIFT, then the number follows the component in which it
is contained to it's new position.

Examples:
> SRename Data:file100 BN TO picture : replaces the existing basename with
"picture" in every filename.

output:
"file100" renamed as "picture100"
"file101" renamed as "picture101"
"file102" renamed as "picture102"
"file103" renamed as "picture103"
  ....

> SRename Data:file100 BN DL : deletes the basename.

output:
"file100" renamed as "100"
"file101" renamed as "101"
"file102" renamed as "102"
"file103" renamed as "103"
  ....

> SRename Data:Frame001.iff BN SW : swaps the basename components.

output:
"Frame001.iff" renamed as "iff.Frame001"
"Frame002.iff" renamed as "iff.Frame002"
"Frame003.iff" renamed as "iff.Frame003"
"Frame004.iff" renamed as "iff.Frame004"
  ....



NUMBERPOS (NP) <position value> :


Sets the position of the number within the basename. Positive position values
means character position from the left and negative values means character
position from the right.

Examples:
> SRename frame100.iff NP 1 : will move all numbers in the filename sequence
at the first character of the basename.

output:
"frame100.iff" renamed as "100frame.iff"
"frame101.iff" renamed as "101frame.iff"
"frame102.iff" renamed as "102frame.iff"
"frame103.iff" renamed as "103frame.iff"
  ....

> SRename 100frame.iff NP -5 : all numbers will be moved at the 5th character
of the basename from the end.

output:
"100frame.iff" renamed as "frame100.iff"
"101frame.iff" renamed as "frame101.iff"
"102frame.iff" renamed as "frame102.iff"
"103frame.iff" renamed as "frame103.iff"
  ....



CASESENS (CS) :


When in renumbering mode this keyword preserves each basename's casing.
If CASESENS is not given all basenames will get their content from the basename
of the first filename in the sequence, which is the default behaviour.

Example:
> SRename frame01 RN 20 CS

output:
"frame01" renamed as "frame20"
"FRAME02" renamed as "FRAME21"
"frame03" renamed as "frame22"
"FRAME04" renamed as "FRAME23"
"frame05" renamed as "frame24"

As you see the second and fourth basename remain in upper case.






NUMBERING


SRename can also add a number sequence to filenames or comments. This is done
by giving a hash character (#) followed by a positive number of up to 9 digits
with the TO or INSERT actions.
The hash preceded number can be surrounded by any other characters. If the
given number contains any leading zeroes these will be used on all the numbers
that will be added, like in renumbering.
The increment value can be changed from the default 1 with the STEP keyword,
again like in renumbering.
There are two main ways to apply numbering to filenames. You can supply a
directory with or without a file pattern, and the selected filenames will be
numbered, or you can explicitly supply all the filenames that will be numbered
in the command line. Note that with the second way recursion is not allowed.

When numbering is used with recursion numbers will be placed in every matched
filename in every directory that is entered. The number will be reset to the
starting value for every directory.
Since the "#" character is now used to indicate numbering in order to use it
literally in filenames, even though this shouldn't be done because it is used
in wildcard patterns, it will have to be given one more time than it is needed.
So to place a single "#" you will have to give "##", for "##" you must give
"###" and so on.
Note that it won't be possible to renumber the filenames that will be produced
after the numbering process because they won't share a common basename.
To renumber the selected filenames the existing numbers will have to be deleted
and then numbering should be applied again.

Examples:

> SRename anydir IN #001 AT -1

output:
"testpic" renamed as "testpic001"
"sample.iff" renamed as "sample.iff002"
"readme.txt" renamed as "readme.txt003"
"datafile" renamed as "datafile004"
"preview.png" renamed as "preview.png005"

> SRename anydir PR TO file#20 ST 2

output:
"testpic" renamed as "file20.testpic"
"sample.iff" renamed as "file22.sample.iff"
"readme.txt" renamed as "file24.readme.txt"
"datafile" renamed as "file26.datafile"
"preview.png" renamed as "file28.preview.png"

> SRename testpic sample.iff readme.txt datafile preview.png IN #50 AT -1

output:
"testpic" renamed as "testpic50"
"sample.iff" renamed as "sample.iff51"
"readme.txt" renamed as "readme.txt52"
"datafile" renamed as "datafile53"
"preview.png" renamed as "preview.png54"






SPECIAL KEYWORDS


The following keywords will stop SRename from doing any actual renaming, but
will instead force it to only display information about which filenames or
comments would be selected for modification or how they would be modified.

SELECTED
SIMULATE



SELECTED (SE) :


This keyword will make SRename only display the filenames that are going to be
selected for renaming according to the supplied selector keywords.
It is not guaranteed that the selected filenames will be renamed successfully
or that they will be changed from what they were.
This keyword was added to make it easier to find filenames that match specific
criteria. It is recommended that you also give the NOPROGRESS (NOP) keyword
when using recursion to obtain a more readable output.
Note that as of this version it is not necessary to also given an action with
the selector keywords.

Examples:

> SRename C:S#? MT c SE : the selected filenames should begin with "S" and
contain "c"

output:
Selected "Search"
Selected "SetClock"
Selected "SetPatch"

> SRename Miscfiles/ SU SE : the selected filenames should have a suffix

output:
Selected "startup.iff"
Selected "readme.txt"
Selected "boing.8svx"
Selected "Default.cfg"



SIMULATE (SM) :


This keyword will disable real renaming and the resulting filenames or comments
will just be displayed. The resulting filenames or comments will not be
entirely accurate because the filesystem that is used ultimately affects the
final form of the filenames, and since no real renaming is done it's effect
will not be shown.
It is recommended that you also give the NOPROGRESS (NOP) keyword when using
recursion to obtain a more readable output.

Example:

> SRename C: 8+3 SM

output:
"AddBuffers" would be renamed as "ADDBUFFE"
"AddDataTypes" would be renamed as "ADDDATAT"
"Assign" would be renamed as "ASSIGN"
"Avail" would be renamed as "AVAIL"
"BindDrivers" would be renamed as "BINDDRIV"
"Break" would be renamed as "BREAK"
"ChangeTaskPri" would be renamed as "CHANGETA"
"ConClip" would be renamed as "CONCLIP"
"Copy" would be renamed as "COPY"
"CPU" would not be changed
  ....







OUTPUT CONTROL


These keywords restrict the amount of information that SRename will print during
renaming.

NOPROGRESS
QUIET



NOPROGRESS (NOP) :


Suppresses the output of the name of the directory that is currently processed
during recursion. This can reduce the time required for the renaming operation
quite a lot in some systems.



QUIET (Q) :


Suppresses all output including error messages. This option is ignored when
SELECTED or SIMULATE is also given.






EMULATED FUNCTIONS :


Some specialized functions like uppercase first character, delete spaces,
spaces to underscores, replace string1 with string2, and others can be built
with other functions. For example:

Uppercase first can be performed with: LEFT 1 UP
Delete spaces with: MATCH " " DELETE
Spaces to underscores with: MATCH " " TO _
Replace string1 with string2 with: MATCH string1 TO string2

Even uppercase after space can be emulated with MATCH " " AFTER LEFT 1 UP, but
as this would not uppercase the first character too I have included a
specialized function to do that.



PRIORITIES :


Selectors are evaluated in this order:

COMMENT
BASENAME
PREFIX
MAIN
SUFFIX
WORD
MATCH
LEFT
MID
RIGHT
EXCLUDE


Actions are executed in this order:

All renumbering actions (exclude all other actions)
DELETE                  (excludes all other actions)
TO                      (excludes all other actions)
INSERT                  (excludes all other actions)
UPPER                   (excludes LOWER and UPAFTERSPC)
LOWER
UPAFTERSPC
LSHIFT                  (excludes RSHIFT)
RSHIFT
SWAP
8+3                     (excludes UPPER, LOWER and UPAFTERSPC, and is excluded
                        if the BASENAME selector is given)
UNIFY


Priority of other keywords:

FILES excludes DIRS
BEFORE excludes AFTER
RLEVEL excludes ALL
SELECTED excludes SIMULATE
SELECTED and SIMULATE exclude QUIET



TIPS:


When you use SRename with a file manager like Directory Opus, and you have set
it up to receive multiple filenames ({O} option in DOpus), place that option
at the end of the command line because if the filename sequence is too big
the arguments after it will be omitted. For example don't give DOpus the
command "SRename {O} UP QUIET", but "SRename UP QUIET {O}".

Since SRename has no way of knowing the maximum filename length that each
filesystem allows, care must be taken by the user not to supply longer
filenames than the filesystem can handle so that filename clashes won't occur.

Although SRename can work with filenames that contain wildcard characters
(i.e. parentheses) and thus are recognised by the OS as file matching patterns,
it will only rename such filenames if it can find them immediately in the
supplied path.
It is not possible for example to specify such a filename and tell SRename to
recurse through the directory tree, renaming every occurrence of this filename,
if it does not find it in the starting directory, because once it can't find it
it will decide that it's a file-matching pattern, which is not what it was
intended for by you.
I advise that such filenames that confuse the OS and other applications not
be used.



LIMITATIONS :


- Because of the way that the ReadArgs OS function works, you can not assign
different actions to different parts of the filename in one go, like for
example SRename anyfilename.suffix LEFT 3 UP SUFFIX DELETE.
The previous command will just delete the 3 leftmost characters from the
suffix (DELETE cancels UP).
This will change in the future.

- Up to 255 directory levels of depth are supported in recursion.

- Recursing is cancelled if a destination path is given.

- The path of a file can't be longer than 1024 characters.


Limitations in Renumbering:

- Numbers in filenames from 0 to 999999999 can be handled.

- No wildcards can be used and when a destination path is supplied no clash
checking takes place (it is assumed that the destination directory contains
no filenames that can clash with the filenames that will be moved there).

- No filenames that contain wildcard characters can be used, because pattern
matching is used to collect the filenames of the sequence.

- Any numbers that have a different format to that of the first number scanned
will not be renumbered: if the first number is 001 and 02,03 follow, these
will not be renumbered because SRename will expect to find 002 and 003.

- A filename clash can not be resolved if the clashing filename is outside the
range of filenames to be renumbered ("New number already exists" error).







PROGRAM HISTORY :


 2.940 :

It is no longer necessary to also give an action when using SELECTED.

Removed the EXIST keyword and replaced it with ADD. ADD does the reverse job
of EXIST and this is necessary because I changed the default behaviour of
SRename when modifying prefix, main and suffix components.
Previously SRename would create such a component even if it didn't previously
exist, but now it won't do that unless ADD is also given. This change was made
in order for SELECTED to work more consistently.

Improved the way that SELECTED works when specific filenames (not wildcards)
are given together with it. Now the given filenames are evaluated and it is
reported for each one if they were selected or not, instead of reporting that
all of them were selected.

Fixed small bug when ICONS and SELECTED was given. The icon's filename was
reported as selected even if the normal filename was not.

Fixed minor glitch in output when SIMULATE was used and the filename would
fail to be renamed. "Can't rename ..." was changed to "Wouldn't rename ..."

Internal reorganisation of the code that selects the parts to be modified
and some other small improvements.


 2.935 :

SRename now uses memory pools for allocating memory and thus requires at least
Kickstart 3. This change resulted in the reduction of the executable's size by
more than 1 K.


 2.930 :

Added numbering after a user's request. It is performed by using a hash (#)
followed by an unsigned integer as an argument with TO or INSERT.

Added the SELECTED option to report which filenames or comments will be
selected for renaming according to the keywords given. It is not guaranteed
that the selected filenames will be changed.

Added the SIMULATE option to show what the renamed filenames will look like.
No actual renaming is done. Note that the results will not be entirely accurate
because as no real renaming is done, the filesystem's effect on the filenames
will not be shown.

Optimized the output by not displaying at all filenames that will not be
renamed because they don't match the selector or other criteria, and also
made the output more readable by printing empty lines between directories.

Allowed the usage of the CONV8+3 action together with TO or DELETE.

Changed the name of NODIROUT (NDO) to NOPROGRESS (NOP). When this option is
used now the paths of the renamed files are also displayed, instead of just
the usual rename message.

Added a warning message that any selectors will be ignored if no matching
action is given and a destination path is given.


 2.920 :

Now SRename is entirely compatible with the OS Rename command. Because of this
the source path in no longer automatically reused for the destination path if
this isn't given in simple renaming, but is only reused if the new SAMEPATH
option is given.

Changed the names of a few keywords to be more standard: RECURSE is now ALL,
NOFILES is DIRS, NODIRS is FILES and ALLDIRS is now GLOBALDIRPAT.

Speeded up simple renaming a bit by executing a destination path checking
routine only in case of failure, to determine the exact cause.
In case of renaming using wildcards or renumbering the destination path
checking is done before the renaming starts, as before.

Simplified the renumbering code reducing the size of the executable a bit.

Fixed bug that caused an enforcer hit when trying to invert (IV option) a
single filename. Now no attempt is made to invert filename sequences that
consist of just one filename.

Fixed bug that caused the erratic modification of the basename of the filename
sequences after the first, when multiple sequences to process were given and
temporary filenames were generated.


 2.910 :

BASENAME has now become a proper selector which means that the basename of a
filename sequence can now receive any of the available actions, and isn't
limited to just replacement anymore.

To complement this feature the position of the number within the basename is
calculated automatically according to the basename's modification.

Added the NUMBERPOS keyword for manually setting the position of the number
within the basename instead of using AT for this, as AT may now be used by
actions that modify the basename.

The UPTO keyword can now also receive a filename so that when SRename is used
from a file manager for renumbering, the user can select the starting and
ending filenames from a lister.

BEFORE and AFTER can now be used with the code and single-character modes of
MATCH.

The code of SWAP, LSHIFT and RSHIFT was completely rewritten to implement the
automatic number positioning with basename modification.

Now if specific components are given with SWAP they must be at least two or
SWAP will do nothing.

Fixed small bug that sometimes caused an enforcer hit when EXCLUDE and DELETE
was given.

Fixed harmless bug in the renumbering code and restructured it for clarity.

General code cleanup.


 2.900 :

After a user's request I also added support for the modification of filename
comments. Because of this the COMMENT, TOCOMMENT and TOFILENAME keywords were
added.

The ICONS option can now be also used with wildcards.

Fixed bug introduced in 2.800 that caused MATCH to finish early when the new
filename was going to be shorter than the old one.

Fixed bug that could cause a crash when ICONS was used with recursion and a
non-wildcard pattern, and a match couldn't be found in the starting directory.


 2.850 :

Simplified the command interface by removing the APPEND and FROMEND keywords.
Their function is now performed by giving negative values to the AT and WORD
keywords respectively.


 2.820 :

Fixed bug introduced in version 2.800 that caused MATCH to fail in some cases.
Reported by Bill Duxbury.


 2.810 :

Fixed bug introduced in version 2.700 that caused DIRPAT and ALLDIRS not to
work properly.


 2.800 :

SRename is now re-entrant and can be made resident.

Rewrote the paged buffer routines so that buffer overflows can't occur anymore
thus removing the limits on how many filenames can be renamed in one go.

Fixed bug that occured when attempting to rename to an empty filename and the
ICONS option was also given.

Increased the maximum recursion limit from 127 to 255 levels.

Improved the output of SRename somewhat.

Optimized some renumbering routines and made many general code improvements.


 2.710 :

Doh! EXCLUDE was still buggy. It didn't work at all with multiple strings to
match so it's code was completely rewritten.

Also fixed a bug with EXCLUDE and the single char mode or character code mode
of the MATCH selector. Now if such a mode is active when EXCLUDE is given the
excluded parts are modified as single characters instead of as character
strings.

Single char mode is automatically activated now if a single character is given
with MATCH.


 2.700 :

Added the WORD selector and FROMEND, INCLSEP, WSEP support keywords.

Removed LENGTH action as it can be performed by MID <len> DELETE.

Fixed bugs with EXCLUDE. Now it performs consistently whatever the selected
part of the filename is, and works correctly with multiple matches (MATCH
selector).

Fixed bug in renumbering. It wouldn't renumber single filenames if the number
was in the beginning.

Increased maximum allowed path to 1024 chars.

Many structural and code optimizations.


 2.610 :

Fixed long standing bug that resulted in higher memory usage than necessary
in renumbering.

Replaced sorting routine in renumbering with qsort.

Some more optimizations in renumbering.


 2.600 :

Now SRename supports filenames up to 120 characters long on filesystems that
allow filenames longer than 30 characters (e.g. SFS)

The real new filename is now printed after renaming, as the filesystem that is
used can affect the final form of the filename.

Small change in temporary filenames to aid renumbering on MS-DOS like
filesystems.


 2.540 :

MATCH selector enhancements:
- Added single character mode, as a result the DELCHARS action was removed,
  as it can be replaced by MATCH :<chars> DELETE.
- Added character code mode supporting ranges.
- MATCH can now accept multiple strings to match.

The SWAP action can now swap the filename parts determined by the PREFIX/MAIN/
SUFFIX selectors, instead of always swapping the two extreme parts.

Increased the limit for maximum number of filenames in each directory to 32768
and of directory names to 4096.

Some more optimizations for speed.


 2.530 :

Changed the way that temporary filenames are named when resolving clashes to
eliminate the possibility that another SRename task could use the same
temporary filenames when trying to resolve a clash.

Now all temporary filenames receive an address that is different for each
SRename task. As a result the limit for numbers contained in filenames has
gone up to just under a billion (999999999).

Failure to perform a temporary rename in renumbering mode now results in an
error message and termination of further processing.

Fixed small bug that caused the casing of the basename in renumbering to be
determined from the given starting filename.

Made a few code optimizations.


 2.520 :

The TO keyword is now optional for some rename actions.

The FILENAME keyword was renamed as FROM.

Fixed serious bug that hampered multiple filepattern renaming when different
directories were given.

Improved the error and other message output.

Errors: "source path not found", "no number in filename" and "invalid number
in filename" do not abort the processing of other filepatterns anymore.

Some code optimizations.


 2.510 :

Added ICONS option for automatic icon renaming.

Fixed a bug in routine that detects same source-destination filename.


 2.500 :

First Aminet release.

Added BEFORE, AFTER, REVMATCH options for MATCH selector.

Added UPDATE option for INSERT action.

Major interface changes: removed additional parameters from MATCH, INSERT and
RENUMBER and made them separate, also changed the full names of LEN, PRE, SUF
and gave abbreviations to PREFIX, MAIN, SUFFIX, LEFT, MID, RIGHT and QUIET.

AT is now used for number positioning in renumbering instead of LEFT and RIGHT.

Removed the DELBASE action.

Fixed bug in TO action.

Can now rename filenames that are recognised by the OS as wildcards if these
filenames are found in the given path.

Fixed bugs introduced in 2.430 that caused misrecognition of same source and
destination filenames.







INTERFACE CHANGES & ADDITIONS :


The command interface of SRename is not 100% backwards compatible with previous
versions as some functions have been replaced by others along the way, and
some improvements have been made to the command interface itself to make it
more consistent and easier to use.
To make it easier to upgrade to newer versions I include a button bank and
a start menu for use with Directory Opus 5 that is set up to work with the
latest version of SRename.

 2.940 :

EXIST was removed and replaced with ADD which does the reverse job.
This was done because the default behaviour of SRename when dealing with
the creation of prefix, main and suffix components was also reversed.

 2.930 :

To implemend numbering the hash character (#) followed by an unsigned integer
is now used as an argument with TO or INSERT. Because of this to place one or
more hash characters in filenames the user will now have to supply one more
hash than the number of hashes that are required. For example to insert one
hash the user must supply two, for two hashes supply three, and so on.

Added the SELECTED option to report which filenames or comments will be
selected for renaming according to the keywords given. It is not guaranteed
that the selected filenames will be changed.

Added the SIMULATE option to show what the renamed filenames will look like.
No actual renaming is done. Note that the results will not be entirely accurate
because as no real renaming is done, the filesystem's effect on the filenames
will not be shown.

Changed the name of NODIROUT (NDO) to NOPROGRESS (NOP).


 2.920 :

Now SRename is completely compatible with the OS Rename command. For this
reason now the path of the file to rename isn't reused automatically as the
path for the new filename, like in previous versions, if that path isn't
supplied by the user.

The SAMEPATH keyword must now be given for the source path to be reused.
SRename can now also accept "" as the destination filename like the OS Rename
does.

The name of a few keywords has changed to be more standard. RECURSE is now ALL,
NOFILES is DIRS, NODIRS is FILES and ALLDIRS is now GLOBALDIRPAT.


 2.910 :

The BASENAME keyword has been turned to a proper selector which means that it
doesn't receive any arguments itself anymore but instead selects the basename
of a filename sequence for modification.

UPTO can now also accept the ending filename itself instead of just the number
that it contains.

NUMBERPOS was added for changing the number position within the basename as
AT that was used before for that purpose may already have been used by actions
that modify the basename.

If specific components (PREFIX-MAIN-SUFFIX) are given with SWAP they must be
at least two or SWAP will do nothing.

The BEFORE and AFTER keywords used with MATCH can now be also used in the
single character (MATCH :characters) and character code (MATCH /ascii codes)
modes of MATCH.


 2.900 :

Added the COMMENT selector to allow the modification of filename comments
and the TOCOMMENT and TOFILENAME keywords to manage the redirection of the
resulting filename or comment.


 2.850 :

Removed the APPEND and FROMEND keywords to simplify the command interface.
Their function is now performed by giving negative values to the AT and WORD
keywords respectively.
Note that the value that AT receives is now higher by 1. For example instead
of giving AT 0 to place a string at the beginning of a filename, you should
now give AT 1 to do that.

Also gone is the limitation that wouldn't allow the insertion of a string at
the end of a filename with normal insertion, that is by not using the append
mode (AT with negative values).

For example:
APPEND is replaced by AT -1
AT 2 APPEND is replaced by AT -2
WORD 1 FROMEND is replaced by WORD -1


 2.710 :

Single character mode is now automatically activated if the string given after
MATCH consists of only one character. This makes the colon ':' that indicates
single character mode unnecessary when matching only a single character.


 2.700 :

LENGTH action removed. It can easily be replaced by MID <num> DELETE.

Added WORD selector, supported by FROMEND, INCLSEP and WSEP.


 2.540 :

MATCH additions: multiple match string support, single character mode, and
character code mode.

DELCHARS was removed as it can be replaced by MATCH :<chars> DELETE.

SWAP now takes into account the PREFIX/MAIN/SUFFIX selectors, so that parts
other than just the extremest can be swapped.


 2.520 :

The TO keyword is no longer needed to perform simple renaming, so you can now
type "SRename oldname newname" to rename "oldname" as "newname".

The FILENAME keyword was renamed as FROM (same as the original rename command).


 2.510 :

The ICONS option was added to automatically rename ".info" files in single or
multiple filename mode (not in wildcard mode).







KNOWN BUGS :


SRename allows you to use long filenames even on filesystems that don't
support them (like FFS), so on such filesystems filenames longer than the
maximum allowed length (30 characters on FFS) will be trimmed by the
filesystem itself.
Similar behaviour can be expected for filename comments. SRename allows for
comments of up to 120 characters in length, but in the end the filesystem can
reject the comment if it's too long (up to 80 characters for FFS).

Although the MATCH selector performs length and position correction for the
selected character range in case of overlapping ranges, actions that accept
position parameters are not corrected.




If you have some suggestion, request, or bug report email me at:
cnicol@compulink.gr